<template>
	<view class="content">
		<image src="../../static/index/index.jpg" class="content-index-image" mode="widthFix"></image>
		<view class="button-index" v-if="btnStatus">
			<text class="text-box" @click="toActivePage" v-if="!isBangDing">{{ btnTitle }}</text>
			<text class="text-box" @click="toUserEquityPage" v-else> {{ btnTitle }} </text>
		</view>
	</view>
</template>

<script>
	import { loginAuthorize } from "@/api/hook.js"
	export default {
		data() {
			return {
				isBangDing: false,
				btnTitle: "",
				btnStatus: false
			}
		},
		async onLoad() {
			const userInfo = await loginAuthorize();
			this.isBangDing = userInfo.customer.idcard && userInfo.customer.phone && userInfo.customer.name;
			this.btnTitle = !this.isBangDing ? "立即激活会员" : "使用权益";
			this.btnStatus = true;
		},
		methods: {
			toActivePage() {
				uni.navigateTo({
					url: "/pages/activeUser/index"
				})
			},
			toUserEquityPage(){
				uni.switchTab({
					url: "/pages/service/service"
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: auto;
	}

	.content-index-image {
		width: 100%;
		height: auto;
		object-fit: contain;
	}

	.button-index {
		width: 80%;
		height: 112rpx;
		background-image: url("../../static/index/active.png");
		background-size: 100% 100%;
		position: fixed;
		bottom: 20rpx;
		left: 10%;
		text-align: center;
		line-height: 88rpx;
	}

	.text-box {
		color: #fff;
		font-size: 40rpx;
	}
</style>